home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-26 | 4.5 KB | 179 lines | [TEXT/CWIE] |
- // ===========================================================================
- // PP Basic Starter.cp ©1994-1997 Metrowerks Inc. All rights reserved.
- // ===========================================================================
- //
- // This file contains the starter code for a basic PowerPlant application
-
- #include "PP Basic Starter.h"
-
- #include <LGrowZone.h>
- #include <LWindow.h>
- #include <PP_Messages.h>
- #include <PP_Resources.h>
- #include <PPobClasses.h>
- #include <UDrawingState.h>
- #include <UMemoryMgr.h>
- #include <URegistrar.h>
- #include <LEditField.h>
- #include "LIconSuitePane.h"
- #include "IconSuitePatches.h"
- #include <SIOUX.h>
- #include <LSIOUXAttachment.h>
-
- // put declarations for resource ids (ResIDTs) here
-
- const ResIDT window_Sample = 1; // EXAMPLE
-
-
- // ===========================================================================
- // • Main Program
- // ===========================================================================
-
- void main(void)
- {
-
- SIOUXSettings.initializeTB = false;
- SIOUXSettings.standalone = false;
- SIOUXSettings.setupmenus = false;
- SIOUXSettings.autocloseonquit = true;
- SIOUXSettings.asktosaveonclose = false;
- SIOUXSettings.showstatusline = false;
-
- // Set Debugging options
- SetDebugThrow_(debugAction_Alert);
- SetDebugSignal_(debugAction_Alert);
-
- InitializeHeap(3); // Initialize Memory Manager
- // Parameter is number of Master Pointer
- // blocks to allocate
-
- // Initialize standard Toolbox managers
- UQDGlobals::InitializeToolbox(&qd);
-
- new LGrowZone(20000); // Install a GrowZone function to catch
- // low memory situations.
-
- InstallAllUniversalPatches ();
-
- CPPStarterApp theApp; // replace this with your App type
- theApp.Run();
- }
-
-
- // ---------------------------------------------------------------------------
- // • CPPStarterApp // replace this with your App type
- // ---------------------------------------------------------------------------
- // Constructor
-
- CPPStarterApp::CPPStarterApp()
- {
- // Register functions to create core PowerPlant classes
-
- RegisterAllPPClasses();
- RegisterClass_(LIconSuitePane);
- RegisterClass_(LIconRefPane);
-
- EnterMovies ();
-
- AddAttachment ( new LSIOUXAttachment () );
- }
-
-
- // ---------------------------------------------------------------------------
- // • ~CPPStarterApp // replace this with your App type
- // ---------------------------------------------------------------------------
- // Destructor
- //
-
- CPPStarterApp::~CPPStarterApp()
- {
- ExitMovies ();
- }
-
- // ---------------------------------------------------------------------------
- // • StartUp
- // ---------------------------------------------------------------------------
- // This function lets you do something when the application starts up
- // without a document. For example, you could issue your own new command.
-
- void
- CPPStarterApp::StartUp()
- {
-
- ObeyCommand(cmd_New, nil); // EXAMPLE, create a new window
-
-
- StartIdling ();
- StartRepeating();
- }
-
- // ---------------------------------------------------------------------------
- // • ObeyCommand
- // ---------------------------------------------------------------------------
- // Respond to commands
-
- Boolean
- CPPStarterApp::ObeyCommand(
- CommandT inCommand,
- void *ioParam)
- {
- Boolean cmdHandled = true;
-
- switch (inCommand) {
-
- // Deal with command messages (defined in PP_Messages.h).
- // Any that you don't handle will be passed to LApplication
-
- case cmd_New:
- // EXAMPLE, create a new window
- LWindow *theWindow;
- theWindow = LWindow::CreateWindow(window_Sample, this);
- theWindow->Show();
- break;
-
-
-
- default:
- cmdHandled = LApplication::ObeyCommand(inCommand, ioParam);
- break;
- }
-
- return cmdHandled;
- }
-
- // ---------------------------------------------------------------------------
- // • FindCommandStatus
- // ---------------------------------------------------------------------------
- // This function enables menu commands.
- //
-
- void
- CPPStarterApp::FindCommandStatus(
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
-
- switch (inCommand) {
-
- // Return menu item status according to command messages.
- // Any that you don't handle will be passed to LApplication
-
- case cmd_New: // EXAMPLE
- outEnabled = true; // enable the New command
- break;
-
- default:
- LApplication::FindCommandStatus(inCommand, outEnabled,
- outUsesMark, outMark, outName);
- break;
- }
- }
-
- void CPPStarterApp::SpendTime(
- const EventRecord &inMacEvent)
- {
- MyGNEFilterRoutine ( (EventRecord*) & inMacEvent );
- }